home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 4.iso / src / swtools / mipsABI / examples / sup / PORT / step06 / scm.c.diff < prev    next >
Encoding:
Text File  |  1994-08-02  |  1.1 KB  |  55 lines

  1. *** ../step03/scm.c    Thu Dec 16 13:59:00 1993
  2. --- scm.c    Fri Dec 17 12:10:18 1993
  3. ***************
  4. *** 180,185 ****
  5. --- 180,188 ----
  6.   #else
  7.   #include <varargs.h>
  8.   #endif
  9. + #ifdef _ABI_SOURCE
  10. + #include <sys/utsname.h>
  11. + #endif
  12.   #include "sup.h"
  13.   
  14.   #if __STDC__
  15. ***************
  16. *** 424,431 ****
  17.   char *myhost ()        /* find my host name */
  18.   {
  19.       struct hostent *h;
  20. !     static char name[MAXHOSTNAMELEN];
  21.   
  22.   
  23.       if (name[0] == '\0') {
  24.           if (gethostname (name,MAXHOSTNAMELEN) < 0)
  25. --- 427,445 ----
  26.   char *myhost ()        /* find my host name */
  27.   {
  28.       struct hostent *h;
  29. ! #ifdef _ABI_SOURCE
  30. !     static struct utsname name;
  31.   
  32. +     if (*(name.nodename) == '\0') {
  33. +         if (uname (&name) < 0)
  34. +             return (NULL);
  35. +         if ((h = gethostbyname (name.nodename)) == NULL)
  36. +             return (NULL);
  37. +         (void) strcpy (name.nodename,h->h_name);
  38. +     }
  39. +     return (name.nodename);
  40. + #else
  41. +     static char name[MAXHOSTNAMELEN];
  42.   
  43.       if (name[0] == '\0') {
  44.           if (gethostname (name,MAXHOSTNAMELEN) < 0)
  45. ***************
  46. *** 435,440 ****
  47. --- 449,455 ----
  48.           (void) strcpy (name,h->h_name);
  49.       }
  50.       return (name);
  51. + #endif
  52.   }
  53.   
  54.   char *remotehost ()    /* remote host name (if known) */
  55.